package day2.排序;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Emp implements Comparable{
    Integer age;
    String name;

    @Override
    public int compareTo(Object o) {
        Emp other = (Emp) o;
//        return age-other.age;
        if(age==other.age){
            return name.compareTo(other.name);
        }else {
            return age-other.age;
        }
    }
}
